{include file='_header'}
<div class="page-header">当前位置：<span class="text-primary">商品组管理</span></div>
<div class="page-content">
    <div class="alert alert-primary">商品组主要用于首页展示调用</div>
    <form action='' method="post">
        <div class="page-toolbar">
            <div class="col-sm-4">
                <a class="btn btn-primary btn-sm" href="{:url('admin/goods/groupadd')}"><i class="fa fa-plus"></i> 添加新组</a>
            </div>
            <div class="pull-right col-sm-6">
                <div class="input-group" style="width:100%;">
                    <input type="text" class="input-sm form-control" name="keyword" value="{$keyword}" placeholder="请输入商品组名称进行搜索">
                    <span class="input-group-btn">
                            <button class="btn btn-primary" type="submit"> 搜索</button>
                        </span>
                </div>
            </div>
        </div>

        {if empty(count($list))}
        <div class="panel panel-default">
            <div class="panel-body empty-data">未查询到{if !empty($keyword)}"{$keyword}"{/if}相关商品组!</div>
        </div>
        {else}
        <div class="row">
            <div class="col-md-12">
                <div class="page-table-header">
                    <input type='checkbox' />
                    <div class="btn-group">
                        <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:url('admin/goods/groupenabled',array('enabled'=>1))}">
                            <i class='icow icow-qiyong'></i> 启用</button>
                        <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch'  data-href="{:url('admin/goods/groupenabled',array('enabled'=>0))}">
                            <i class='icow icow-jinyong'></i> 禁用</button>
                        <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle="batch-remove" data-confirm="确认要删除?" data-href="{:url('admin/goods/groupdelete')}" disabled="disabled">
                            <i class="icow icow-shanchu1"></i>删除
                        </button>
                    </div>
                </div>
            <table class="table table-responsive">
            <thead>
            <tr>
                <th style="width:25px;"></th>
                <th>商品组名称</th>
                <th></th>
                <th style="width: 70px;">状态</th>
                <th style="width: 65px">操作</th>
            </tr>
            </thead>
                <tbody>
                {foreach name='list' item='item'}
                <tr>
                    <td>
                        <input type="checkbox" value="{$item['id']}">
                    </td>
                    <td>{$item['name']}</td>
                    <td></td>
                    <td>
                        <span class='label {if $item['enabled']==1}label-primary{else}label-default{/if}'
                        data-toggle='ajaxSwitch'
                        data-switch-value='{$item['enabled']}'
                        data-switch-value0='0|禁用|label label-default|{:url('admin/goods/groupenabled',array('enabled'=>1,'id'=>$item['id']))}'
                        data-switch-value1='1|启用|label label-primary|{:url('admin/goods/groupenabled',array('enabled'=>0,'id'=>$item['id']))}'
                        >
                        {if $item['enabled']==1}启用{else}禁用{/if}</span>
                    </td>
                    <td>
                        <a class="btn btn-default btn-sm btn-operation btn-op" href="{:url('admin/goods/groupedit', array('id'=>$item['id']))}">
                             <span data-toggle="tooltip" data-placement="top" title="" data-original-title="修改">
                                 <i class="icow icow-bianji2"></i>
                            </span>
                        </a>
                        <a class="btn btn-default btn-sm btn-operation btn-op" data-toggle="ajaxRemove" href="{:url('admin/goods/groupdelete', array('id'=>$item['id']))}" data-confirm="确定要删除该分组吗？">
                           <span data-toggle="tooltip" data-placement="top" title="" data-original-title="删除">
                               <i class="icow icow-shanchu1"></i>
                            </span>
                            </a>
                    </td>
                </tr>
                {/foreach}
                </tbody>
                    <tfoot>
                    <tr>
                        <td><input type="checkbox"></td>
                        <td>
                            <div class="btn-group">
                                <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:url('admin/goods/groupenabled',array('enabled'=>1))}">
                                    <i class='icow icow-qiyong'></i> 启用</button>
                                <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch'  data-href="{:url('admin/goods/groupenabled',array('enabled'=>0))}">
                                    <i class='icow icow-jinyong'></i> 禁用</button>
                                <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle="batch-remove" data-confirm="确认要删除?" data-href="{:url('admin/goods/groupdelete')}" disabled="disabled">
                                       <i class="icow icow-shanchu1"></i>删除
                                </button>
                            </div>
                        </td>
                        <td colspan="3" style="text-align: right">
                            {$pager}
                        </td>
                    </tr>
                    </tfoot>
                </table>
            </div>
        </div>
        {/if}
    </form>
</div>
{include file='_footer'}